{% extends "base.html" %}
{# Copyright The IETF Trust 2015, All Rights Reserved #}
{% load origin %}
{% load django_bootstrap5 %}
{% block title %}Reset Charter Milestones for {{ group.acronym }} {{ group.type.name }}{% endblock %}
{% block content %}
    {% origin %}
    <h1>
        Reset Charter Milestones
        <br>
        <small class="text-body-secondary">{{ group.acronym }} {{ group.type.name }}</small>
    </h1>
    <p class="mt-3">
        Select which of the current {{ group.type.name }} milestones you would like to copy to the charter:
        {% if charter_milestones %}
            This will discard {{ charter_milestones|length }} existing charter milestone{{ charter_milestones|pluralize }}
        {% endif %}
    </p>
    <form class="my-3" method="post" id="reset-charter-milestones">
        {% csrf_token %}
        <div class="mb-3">
            {% for milestone in current_milestones %}
                <div class="form-check">
                    <input class="form-check-input"
                           type="checkbox"
                           name="milestone"
                           value="{{ milestone.id }}"
                           id="id-{{ milestone.id }}"
                           {% if not milestone.resolved %}checked{% endif %}>
                    <label class="form-check-label" for="id-{{ milestone.id }}">
                        {{ milestone.desc }}
                    </label>
                    <span class="badge rounded-pill {% if milestone.resolved %}text-bg-success{% else %}text-bg-info{% endif %}">
                        {% if milestone.resolved %}
                            {{ milestone.resolved }}
                        {% else %}
                            {% if group.uses_milestone_dates %}{{ milestone.due|date:"M Y" }}{% endif %}
                        {% endif %}
                    </span>
                </div>
            {% endfor %}
        </div>
        <a class="btn btn-secondary float-end"
           href="{% url 'ietf.group.milestones.edit_milestones;charter' group_type=group.type_id acronym=group.acronym %}">
            Back
        </a>
        <button type="submit" class="btn btn-primary">Submit</button>
    </form>
{% endblock %}